<div class="pure-u-1">
    <h1>Reset password</h1>

    {{#error_message}}<div class="cm-error">{{error_message}}</div>{{/error_message}}

    <p>Enter your email below. once submitted, make sure check your inbox for further instructions.</p>
    <form class="cm-subscription-reset" action="" id="cash_{{element_type}}_form_{{element_id}}" method="post">
        <input type="text" class="cm-subcription-email" name="email" placeholder="your email address" value="{{email_address}}">
        <input type="hidden" name="state" value="reset_password">
        <input type="hidden" name="element_id" value="{{element_id}}">
        <input type="hidden" name="plan_id" value="{{plan_id}}" />
        <input type="hidden" name="finalize_url" class="finalize_url" value="">
        <button class="cm-reset-submit">Reset</button>
    </form>
</div><!--pure-->





<script type="text/javascript">
    (function() {
        'use strict';
        var cm = window.cashmusic;

        cm.events.add(cm,'ready', function(e) {
            cm.session.start();

            var reset_password = document.querySelector('.cm-reset-submit');

            if (reset_password) {
                cm.events.add(reset_password, 'click', function (e) {
                    e.preventDefault();
                    var form = document.querySelector('.cm-subscription-reset');

                    var finalize_url = document.querySelector('.finalize_url');

                    if (cm.embedded) {
                        if (cm.get['params']['location']) {
                            finalize_url.value = encodeURI(cm.get['params']['location']);
                        } else {
                            finalize_url.value = encodeURI(window.location.href);
                        }
                    } else {

                        finalize_url.value = encodeURI(top.location.href);
                    }

                    form.submit();

                });
            }


        });

    }());
</script>



